﻿<!DOCTYPE html>
<!-- saved from url=(0014)about:internet -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;hidden;margin:0;}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.4"></script>
<title>添加普通标注点</title>
</head>
<body>
<div id="allmap"></div>
</body>
</html>
<script type="text/javascript">
var map = new BMap.Map("allmap");
map.centerAndZoom(new BMap.Point(121.506837,31.289236), 14);
map.enableScrollWheelZoom();

var pointsList = [
{ "Longitude": 121.506837, "Latitude": 31.288236, "Time": "2012-02-23", "Description": "会议行程 大活中心" },
{ "Longitude": 121.505837, "Latitude": 31.289236, "Time": "2012-02-21", "Description": "会议行程 机械学院" },
{ "Longitude": 121.507837, "Latitude": 31.288236, "Time": "2012-02-22", "Description": "会议行程 体育馆" },
{ "Longitude": 121.506837, "Latitude": 31.287236, "Time": "2012-02-20", "Description": "会议行程 传播艺术学院" }
 ];
var points = [];

for (var i = 0; i < pointsList.length; i++) {
    addMarker(new BMap.Point(pointsList[i].Longitude, pointsList[i].Latitude), pointsList[i].Time, pointsList[i].Description);
    points.push(new BMap.Point(pointsList[i].Longitude, pointsList[i].Latitude));
}

function addMarker(point,time,des)
{
	//创建小狐狸
	var myIcon = new BMap.Icon("http://www.easyicon.cn/download/png/501625/32/", new BMap.Size(32,32));
	var marker2 = new BMap.Marker(point,{icon:myIcon});  // 创建标注
	map.addOverlay(marker2);              // 将标注添加到地图中

	//让小狐狸说话（创建信息窗口）
	var sContent2 = "<div style='width:50px,background-color:rgb(256,0,0);'><p style='font-size:14px;'>"+time+"</p><p style='font-size:14px;'>"+des+"</p></div>";
	var infoWindow2 = new BMap.InfoWindow(sContent2);
	infoWindow2.setWidth(220);
	marker2.addEventListener(
	"click", function(){this.openInfoWindow(infoWindow2);}
);
}

map.setViewport(points);

</script>
